package rmaqlc31.basic;

import java.util.Scanner;

public class J05_CalrendarV1 {

	public static void main(String[] args) {
		
		Scanner sc = null;
		
		int a;
		int b =1;
		int c;
		
		sc = new Scanner(System.in);
		
		System.out.println("년도를 입력하세요 : ");
		a = sc.nextInt();
		
		System.out.println("Sun"+"\t"+"Mon"+"\t"+"Tue"+"\t"+"Wed"+"\t"+"Thu"+"\t"+"Fri"+"\t"+"Sat"+"\t");
		
		c = ((a-1)*365+(a-1)/4-(a-1)/100+(a-1)/400)%7+1;
		
		if(c==0){			
			while(b<=31){
				if(b%7==0){
					System.out.println(b);
					}
				else
					System.out.print(b+"\t");
				++b;
				}
		}
		else if(c==1){
			System.out.print("\t");
			while(b<=31){				
				if(b%7==6){
					System.out.println(b);
				}
				else
					System.out.print(b+"\t");
				++b;
			}
		}
		else if(c==2){
			System.out.print("\t"+"\t");
			while(b<=31){				
				if(b%7==5){
					System.out.println(b);
				}
				else
					System.out.print(b+"\t");
				++b;
			}
		}
		else if(c==3){
			System.out.print("\t"+"\t"+"\t");
			while(b<=31){				
				if(b%7==4){
					System.out.println(b);
				}
				else
					System.out.print(b+"\t");
				++b;
			}
		}
		else if(c==4){
			System.out.print("\t"+"\t"+"\t"+"\t");
			while(b<=31){				
				if(b%7==3){
					System.out.println(b);
				}
				else
					System.out.print(b+"\t");
				++b;
			}
		}
		else if(c==5){
			System.out.print("\t"+"\t"+"\t"+"\t"+"\t");
			while(b<=31){				
				if(b%7==2){
					System.out.println(b);
				}
				else
					System.out.print(b+"\t");
				++b;
			}
		}
		else{
			System.out.print("\t"+"\t"+"\t"+"\t"+"\t"+"\t");
			while(b<=31){				
				if(b%7==1){
					System.out.println(b);
				}
				else
					System.out.print(b+"\t");
				++b;
			}
		}
		
		 
			
		sc.close();
	}

}
